package com.tentact.coolmeetingtest.service;

import com.tentact.coolmeetingtest.dao.DeptDao;
import com.tentact.coolmeetingtest.support.RetMsg;
import com.tentact.coolmeetingtest.vo.Dept;

import java.util.List;

/**
 * @author 星环
 * @date 2023/1/10 19:22:25
 * @description
 */
public class DeptService {
    DeptDao deptDao = new DeptDao();
    public RetMsg addDept(String name){
        return deptDao.addDept(name) == 1 ? RetMsg.suc("添加成功!") :RetMsg.error("添加失败！");
    }

    public List<Dept> getAllDept() {
        return deptDao.getAllDept();
    }

    public RetMsg deleteDept(Integer i) {
        return deptDao.deleteDept(i) == 1 ? RetMsg.suc("删除成功!") :RetMsg.error("删除失败！");

    }

    public RetMsg updateDept(Integer i, String deptName) {
        return deptDao.updateDept(i,deptName) == 1 ? RetMsg.suc("修改成功!") :RetMsg.error("修改失败！");
    }
}
